<script type="text/javascript">
  function showData(st_member){
    if(st_member){
    	document.form2.hdn_st_member.value = st_member;

  	  //document.forms['form2'].action = "<?=$this->baseUrl?>/members/list-members/st_member/" + st_member;

	    document.form2.submit();
    }
	}
</script>
<table border="0" cellpadding="0" cellspacing="0" align="center" width="100%" style="margin-top: 30px; margin-bottom: 30px; padding-left: 30px; padding-right: 30px;">
  <tr>
    <td style="vertical-align: top;">
      <table border="0" cellpadding="0" cellspacing="0" align="center">
        <tr>
			    <td class="label_page" width="135" align="center">
			      <span>Listagem de Usuários</span>
			    </td>
			    <td>&nbsp;</td>
			  </tr>
			  
			  <tr>
			    <td align="center" colspan="2" class="content_page" style="padding: 10px;">
			      <table border="0" align="center" cellpadding="0" cellspacing="0">
			        <tr>
			          <td>
			            <form name="form1" method="POST" action="">
			              <table border="0" align="center" cellpadding="0" cellspacing="0">
			                <tr>
			                  <td align="right" class="label">Login:</td>
			                  <td align="left"><input type="text" name="ds_login" id="ds_login" class="text_field" size="40"/></td>
			                  <td align="left" style="padding-left: 10px;"><input type="submit" name="btn_submit" id="btn_submit" class="button"/></td>
			                </tr>
			              </table>
			            </form>
			          </td>
			        </tr>
			        
			        <tr>
                <td colspan="11" height="15">&nbsp;</td>
              </tr>
            </table>  
            
            <table border="0" align="center" cellpadding="0" cellspacing="0">
              <tr>
			          <td colspan="11" height="15" align="right">
			            <form name="form2" method="POST" action="<?=$this->baseUrl?>/members/list-members">
			              <input id="hdn_st_member" name="hdn_st_member" value="" type="hidden"/>
			              <input type="submit" name="btn_active" id="btn_acive" class="button" value="Ativos" onclick="showData(1);"/>
			              <input type="submit" name="btn_blocked" id="btn_blocked" class="button" value="Bloqueados" onclick="showData(2);"/>
			              <input type="submit" name="btn_deleted" id="btn_deleted" class="button" value="Excluídos" onclick="showData(3);"/>
			            </form>  
			          </td>
			        </tr>
			        
			        <tr>
                <td colspan="11" height="3"></td>
              </tr>
  
              <tr class="header_list">
			          <td class="cell_header_list" title="LOGIN DO USUÁRIO">Login</td>
			          <td class="cell_header_list" title="NOME COMPLETO DO USUÁRIO">Nome</td>
			          <td class="cell_header_list" title="PERFIL DO USUÁRIO">Perfil</td>
			          <td class="cell_header_list" title="NOME DO CLIENTE">Cliente</td>
			          <td class="cell_header_list" title="NOME DA ORGANIZAÇÃO">Organização</td>
			          <td class="cell_header_list" title="SE A DATA FOR ATUAL, SIGNIFICA QUE O USUÁRIO ESTÁ LOGADO">Último Login</td>
			          <td class="cell_header_list" title="DATA DO ULTIMO ACESSO">Último Logout</td>
			          <td class="cell_header_list" title="ENDEREÇO IP DO ÚLTIMO ACESSO">IP</td>
			          <td class="cell_header_list" title="EDITAR AS INFORMAÇÕES DO USUÁRIO">Editar</td>
			          <td class="cell_header_list" title="EXCLUIR OU BLOQUEAR O USUÁRIO">Bloquear</td>
			          <td class="cell_header_list" title="EXCLUIR OU BLOQUEAR O USUÁRIO">Excluir</td>
			        </tr>
			       
			        <?php 
			          if(count($this->paginator) == 0){?>
			            <tr>
			              <td colspan="11" class="data_not_found">
			                Nenhum Registro Encontrado.
			              </td>
			            </tr>
			            <?php
			          }
			          else{
			            foreach($this->paginator as $data){
			              $data = (object)$data;
			              ?>
			              <tr class="line_data">
			                <td class="cell_list_data"><?php echo $data->ds_login?></td>
			                <td class="cell_list_data"><?php echo utf8_encode($data->ds_member)?></td>
			                <td class="cell_list_data"><?php echo utf8_encode($data->ds_profile)?></td>
			                <td class="cell_list_data"><?php echo utf8_encode($data->ds_customer)?></td>
			                <td class="cell_list_data"><?php echo utf8_encode($data->ds_organization)?></td>
			                <td class="cell_list_data"><?php echo $data->dt_login?></td>
			                <td class="cell_list_data"><?php echo $data->dt_logout?></td>
			                <td class="cell_list_data"><?php echo $data->ds_last_ip == "" ? "ND" : $data->ds_last_ip ?></td>
			                <td class="cell_list_data">
			                  <form name="form3" method="POST" action="<?php echo $this->baseUrl?>/members/form-update-member">
			                    <input type="hidden" name="cod" id="cod" value="<?php echo $data->idMember?>">
			                    <input type="image" src="<?php echo $this->baseUrl?>/imagens/page_edit.png" width="16" height="16" title="Editar Registro">
			                  </form>
			                </td>
			                <?php 
			                  if($data->st_member == 1){
			                    $action_block = $this->baseUrl . "/members/form-confirmation-block-member";
			                    
			                    $icon_block = $this->baseUrl . "/imagens/cad_closed_16_16.png";
			                    
			                    $action_delete = $this->baseUrl . "/members/form-confirmation-delete-member";
			                    
			                    $icon_delete = $this->baseUrl . "/imagens/delete.png";
			                  } 
			                  elseif($data->st_member == 2){
			                    $action_block = $this->baseUrl . "/members/form-confirmation-unblock-member";
			                    
			                    $icon_block = $this->baseUrl . "/imagens/cad_opened_16_16.png";
			                    
			                    $action_delete = $this->baseUrl . "/members/form-confirmation-delete-member";
			                    
			                    $icon_delete = $this->baseUrl . "/imagens/delete.png";
			                  }
			                  else{
			                    $action_block = $this->baseUrl . "/members/list-members";
			                    
			                    $icon_block = $this->baseUrl . "/imagens/no_change.png";
			                    
			                    $action_delete = $this->baseUrl . "/members/confirmation-reactivate";
			                    
			                    $icon_delete = $this->baseUrl . "/imagens/active.png";
			                  } 
			                ?>
			                <td class="cell_list_data">
			                  <form name="form4" method="POST" action="<?php echo $action_block?>">
			                    <input type="hidden" name="cod" id="cod" value="<?php echo $data->idMember?>">
			                    <input type="image" src="<?php echo $icon_block?>" width="16" height="16" title="Bloquear Registro">
			                  </form>
			                </td>
			                <td class="cell_list_r" align="center">
			                  <form name="form5" method="POST" action="<?php echo $action_delete?>">
			                    <input type="hidden" name="cod" id="cod" value="<?php echo $data->idMember?>">
			                    <input type="image" src="<?php echo $icon_delete?>" width="16" height="16" title="Excluir Registro">
			                  </form>
			                </td>
			              </tr>
			              <?php
			            } 
			            ?>
			            <tr height='30px'>
			              <td colspan='11' align="left" valign='top'><?php echo $this->paginator?></td>
			            </tr>
			            <?php
			          }
			        ?> 
			      </table>
			    </td>
			  </tr>
      </table>
    </td>
  </tr>
</table>